﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;

namespace ChinaDynastyTours.Views
{
    public partial class PrintPreviewForm :  DevExpress.XtraEditors.XtraForm
    {
        public PrintPreviewForm(XtraReport rptSource,string watermarkFilePath)
        {
            InitializeComponent();

            printBarManager1.Form = printControl1;
            printBarManager1.Initialize(printControl1);
            printBarManager1.Bars[0].Visible = false;
            printBarManager1.MainMenu.Visible = false;
            if (System.IO.File.Exists(watermarkFilePath))
            {
                rptSource.Watermark.Image = Image.FromFile(watermarkFilePath);
                rptSource.Watermark.ImageViewMode = DevExpress.XtraPrinting.Drawing.ImageViewMode.Stretch;
            }
            printControl1.PrintingSystem= rptSource.PrintingSystem;
            //printingSystem1 rptSource.PrintingSystem.Document;
            rptSource.CreateDocument();
        }
    }
}
